package com.maxcion.scalelayoutmanager

import android.graphics.Color
import android.util.Log
import android.view.ViewGroup
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class MyAdapter() : BaseQuickAdapter<Int, BaseViewHolder>(R.layout.item) {
    private var list = arrayOf(Color.BLUE, Color.CYAN, Color.DKGRAY, Color.GREEN, Color.MAGENTA)
    override fun convert(holder: BaseViewHolder, item: Int) {
        holder.getView<TextView>(R.id.item).text = "~~~ ${item}"
//        holder.setText(R.id.tv, "-----")
        holder.setBackgroundColor(R.id.item, list[item % 4])
        Log.e("LKY","item ${holder.adapterPosition}")

    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
        return super.onCreateViewHolder(parent, viewType)
    }

    override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
        super.onBindViewHolder(holder, position)
        Log.e("LKY","onBindViewHolder")
    }
}